//========================================================================
//  SE5 Empire Main - Ukra-Tal - Captain Kwok's Balance Mod v125+
//========================================================================

#include Script_AI_GlobalConstants.txt
#include Script_AI_GlobalVariables.txt

//------------------------------------------------------------------------
// Global Constants
//------------------------------------------------------------------------

//------------------------------------------------------------------------
// Global Variables
//------------------------------------------------------------------------

//------------------------------------------------------------------------
// Forward Declarations
//------------------------------------------------------------------------
deffunc

function Set_Race_Script_Values returns boolean
params
end

function Set_Race_Default_Settings returns boolean
params
end

function Set_Race_Vehicle_Amounts returns boolean
params
end

function Set_Race_Research_Spending returns boolean
params
end

function Set_Race_Research_Areas returns boolean
params
end

function Set_Race_Weapon_Choices returns boolean
params
  vehicle_type:              string
  vehicle_tonnage:           long
  design_type:               string
end

function Set_Race_Overall_Spending_Percentages returns boolean
params
end

function Set_Race_Strategy_Preferences returns boolean
params
end

function Set_Race_Political_Settings returns boolean
params
end

enddeffunc

//------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------

#include Script_AI_GlobalFunctions.txt
#include Script_AI_GlobalSettings.txt
#include Script_AI_Lists.txt
#include Script_AI_StateChange.txt
#include Script_AI_ColonyType.txt
#include Script_AI_Construction.txt
#include Script_AI_DesignCreation.txt
#include Script_AI_EnemyAnalysis.txt
#include Script_AI_PerformanceAnalysis.txt
#include Script_AI_Intelligence.txt
#include Script_AI_Orders_Planets.txt
#include Script_AI_Orders_Ships.txt
#include Script_AI_Restricted_SolarSystems.txt
#include Script_AI_Politics.txt
#include Script_AI_Research.txt

//------------------------------------------------------------------------
// Main
//------------------------------------------------------------------------
function Main returns boolean
begin

  // Base values for this AI
  call Set_Game_Settings()
  call Set_Race_Script_Values()

  // Set basic item IDs
  call Set_Facility_Id()
  call Set_Vehicle_Sizes()

  // Generate lists for AI use
  call AI_Generate_Lists()

  // Analyze enemies
  call AI_EnemyAnalysis()
  call AI_PerformanceAnalysis()

  // Compute any state changes
  call AI_StateChange()

  // Set race preferences
  call Set_Race_Default_Settings()
  call Set_Race_Point_Modifiers()
  call Set_Race_Resource_Modifiers()
  call Set_Race_Vehicle_Amounts()
  call Set_Race_Design_Types()
  call Set_Race_Research_Spending()
  call Set_Race_Research_Areas()
  call Set_Race_Overall_Spending_Percentages()
  call Set_Race_Strategy_Preferences()
  call Set_Race_Political_Settings()

  // Execute AI Controls
  call AI_SetColonyTypes()
  call AI_Restricted_SolarSystems()
  call AI_DesignCreation()
  call AI_Politics()
  call AI_Research()
  call AI_Intelligence()
  call AI_Orders_Planets()
  call AI_Orders_Ships()
  call AI_Construction()

end

//------------------------------------------------------------------------
// Main_Create_Specific_Design (Called externally in Create Design window)
//------------------------------------------------------------------------
function Main_Create_Specific_Design returns boolean
params
  design_id:                 long
  retval:                    boolean
begin

  call Set_Vehicle_Sizes()
  call Set_Race_Research_Areas()
  call Set_Race_Design_Types()
  set retval := Create_Specific_Design(design_id)

  return retval
end

//------------------------------------------------------------------------
// Set_Race_Script_Values
//------------------------------------------------------------------------
function Set_Race_Script_Values returns boolean
begin

  // Ukra-Tal AI category
  set lng_AI_Categorization                                          := AI_CATEGORY_NEUTRAL
  set lng_AI_Secondary_Categorization                                := AI_CATEGORY_PEACEFUL
  set lng_AI_Villain_Status                                          := AI_CATEGORY_NOT_VILLAIN

  // Consider a category change for the game (25% chance)
  if (sys_long_Game_Date = (Sys_Get_Game_Start_Date() + 1)) then
    if (Sys_Get_Random_Long(1, 4) = 1) then
      // Use our secondary category
      call Sys_Set_AI_Storage_Long(sys_long_Player_ID, 1, 12, lng_AI_Secondary_Categorization)
    else
      call Sys_Set_AI_Storage_Long(sys_long_Player_ID, 1, 12, 0)
    endif
    // We're never a villain
    call Sys_Set_AI_Storage_Long(sys_long_Player_ID, 1, 13, lng_AI_Villain_Status)
  endif

  // Check to see if we're using our secondary category, if yes, then set our category to our secondary category
  if (Sys_Get_AI_Storage_Long(sys_long_Player_ID, 1, 12) > 0) then
    set lng_AI_Categorization := lng_AI_Secondary_Categorization
    // Debug text
    call Sys_Debug_Print("Enemy Analysis", "  - Using Secondary AI Category (" + Sys_Convert_Long_To_String(lng_AI_Secondary_Categorization) + ")")
  endif

  // Check to see if we're a game villain
  if (Sys_Get_AI_Storage_Long(sys_long_Player_ID, 1, 13) > 0) then
    set lng_AI_Villain_Status := AI_CATEGORY_VILLAIN
    // Debug text
    call Sys_Debug_Print("Enemy Analysis", "  - Are a Game Villain!")
  endif

  // Ukra-Tal racial traits
  set bool_Race_Uses_Crystalline_Tech                                := FALSE
  set bool_Race_Uses_Interdimensional_Tech                           := FALSE
  set bool_Race_Uses_Organic_Tech                                    := TRUE
  set bool_Race_Uses_Psychic_Tech                                    := FALSE
  set bool_Race_Uses_Temporal_Tech                                   := FALSE
  set bool_Race_Uses_Religious_Tech                                  := FALSE

  // Ukra-Tal starting strategies
  set lng_AI_Empire_Strategy                                         := AI_EMPIRE_STRATEGY_PEACEFUL
  set lng_AI_Empire_Design_Strategy                                  := AI_DESIGN_STRATEGY_MIXED

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Default_Settings
//------------------------------------------------------------------------
function Set_Race_Default_Settings returns boolean
begin

  // Ukra-Tal design type preferences
  set bool_Race_Uses_Mines                                           := TRUE
  set bool_Race_Uses_Remote_Mines                                    := TRUE
  set bool_Race_Uses_Fighters                                        := TRUE
  set bool_Race_Uses_Remote_Fighters                                 := TRUE
  set bool_Race_Uses_Satellites                                      := TRUE
  set bool_Race_Uses_Remote_Satellites                               := TRUE
  set bool_Race_Uses_Troops                                          := TRUE
  set bool_Race_Uses_Weapon_Platforms                                := TRUE
  set bool_Race_Uses_Drones                                          := FALSE
  set bool_Race_Uses_Remote_Drones                                   := FALSE
  set bool_Race_Uses_Explorer_Ships                                  := TRUE
  set bool_Race_Uses_Scout_Ships                                     := bool_Race_Is_Not_Alone
  set bool_Race_Uses_Patrol_Ships                                    := bool_Race_Is_Not_Alone
  set bool_Race_Uses_Seeker_Ships                                    := TRUE
  set bool_Race_Uses_Kamikaze_Ships                                  := FALSE
  set bool_Race_Uses_Boarding_Ships                                  := TRUE
  set bool_Race_Uses_Bombardment_Ships                               := FALSE
  set bool_Race_Uses_Plague_Ships                                    := TRUE
  set bool_Race_Uses_Remote_Mining_Ships                             := bool_Race_Minerals_Low or bool_Race_Minerals_Adequate
  set bool_Race_Uses_Remote_Farming_Ships                            := TRUE
  set bool_Race_Uses_Remote_Refining_Ships                           := bool_Race_Radioactives_Low or bool_Race_Radioactives_Adequate
  set bool_Race_Uses_Stellar_Manipulation_Ships                      := TRUE
  set bool_Race_Uses_Evil_Stellar_Manipulation_Ships                 := FALSE

  // Ukra-Tal component preferences
  set bool_Race_Uses_Normal_Armor                                    := FALSE
  set bool_Race_Uses_Normal_Shields                                  := FALSE
  set bool_Race_Uses_Cloaking_Devices                                := FALSE
  set bool_Race_Uses_Master_Computers                                := FALSE
  set bool_Race_Uses_Combat_Best_Experience                          := TRUE
  set bool_Race_Uses_Autonomic_Ganglions_Only_Combat                 := (lng_AI_Num_Of_Wars > 0)
  set bool_Race_Uses_Autonomic_Ganglions_Always                      := FALSE
  // Ratio of launchers on carriers (30 to 80)
  set lng_AI_Design_Ratio_Launchers                                  := 56

  // Ukra-Tal unit percentages for colonies
  set lng_AI_Pct_Troops_For_Colonies                                 := 80
  set lng_AI_Pct_Fighters_For_Colonies                               := 50
  set lng_AI_Pct_Satellites_For_Colonies                             := 50
  set lng_AI_Pct_Mines_For_Colonies                                  := 20
  set lng_AI_Pct_Drones_For_Colonies                                 := 100

  // Ukra-Tal unit group sizes
  set lng_AI_Min_Fighter_Group_Size                                  := 20
  set lng_AI_Min_Satellite_Group_Size                                := 4
  set lng_AI_Min_Drone_Group_Size                                    := 10
  set lng_AI_Min_Mine_Group_Size                                     := 20

  // Ukra-Tal scrap values
  set lng_Ship_Obsolete_Time_To_Scrap                                := 80
  set lng_Max_Ships_To_Scrap                                         := 4
  set lng_Unit_Obsolete_Time_To_Scrap                                := 80
  set lng_Max_Units_To_Scrap                                         := 120

  // Ukra-Tal attack/defense preferences
  set lng_Max_Attack_Systems                                         := 3
  set lng_Max_Defense_Systems                                        := 3

  // Ukra-Tal fleet preferences
  set lng_Percent_Of_Attack_Ships_To_Use_For_Fleets                  := 90
  set lng_Pct_Fleets_For_Attack                                      := 40
  set lng_Pct_Fleets_For_Defense                                     := 60
  set lng_Pct_Ships_For_Attack_Fleets                                := 70
  set lng_Pct_Ships_For_Defense_Fleets                               := 30
  set lng_AI_Fleet_Size                                              := FLEET_SIZE_SMALL

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Vehicle_Amounts
//------------------------------------------------------------------------
function Set_Race_Vehicle_Amounts returns boolean
params
vars
  size_dist_mod:             long
  size_mod:                  long
  empire_mod:                long
  attack_mod:                long
  defense_mod:               long
  seeker_mod:                long
  baseship_mod:              long
  explore_mod:               long
  scout_mod:                 long
  patrol_mod:                long
  pd_mod:                    long
  kamikaze_mod:              long
  carrier_mod:               long
  base_mod:                  long
  troop_mod:                 long
  fighter_mod:               long
  wp_mod:                    long
  sat_mod:                   long
  mine_mod:                  long
  drone_mod:                 long
  minerals_mod:              long
  organics_mod:              long
  radioactives_mod:          long
begin

  // Ukra-Tal ship size distribution modifiers
  if Is_Vehicle_Size_Available("Light Cruiser") then
    if (bool_Enemy_Far_Ahead_In_Ships) or (bool_Enemy_Ships_Are_Much_Faster) then
      set size_dist_mod := size_dist_mod + 10
      set size_mod := size_mod + 6
    endif
    if (bool_AI_Design_Preference_Small) then
      set size_dist_mod := size_dist_mod + 10
      set size_mod := size_mod + 9
    endif
    // Ukra-Tal ship size distribution
    set lng_Pct_Small_Ships := 40 + size_dist_mod
    set lng_Pct_Medium_Ships := 50 - size_dist_mod
    set lng_Pct_Large_Ships := 10
  else
    if Is_Vehicle_Size_Available("Destroyer") then
      set lng_Pct_Small_Ships := 60
      set lng_Pct_Medium_Ships := 40
    else
      set lng_Pct_Small_Ships := 100
    endif
  endif

  // Carriers
  if Is_Vehicle_Size_Available("Heavy Carrier") then
    set lng_Pct_Small_Carriers := 70
    set lng_Pct_Medium_Carriers := 30
    set lng_Pct_Large_Carriers := 0
  else
    if Is_Vehicle_Size_Available("Carrier") then
      set lng_Pct_Small_Carriers := 70
      set lng_Pct_Medium_Carriers := 30
    else
      set lng_Pct_Small_Carriers := 100
    endif
  endif

  // Bases
  if Is_Vehicle_Size_Available("Starbase") then
    set lng_Pct_Small_Bases := 70
    set lng_Pct_Large_Bases := 30
  else
    set lng_Pct_Small_Bases := 100
  endif

  // Weapon Platforms
  if Is_Vehicle_Size_Available("Large Weapon Platform") then
    set lng_Pct_Small_WPs := 50
    set lng_Pct_Large_WPs := 50
  else
    set lng_Pct_Small_WPs := 100
  endif

  // Ukra-Tal vehicle amount modifiers
  // Empire size
  set empire_mod := Sys_Divide_Long(lng_AI_Empire_Num_Facilities, 1500)

  // Diplomacy
  if (bool_Race_Is_Not_Alone) then
    set explore_mod := explore_mod - 12
    set scout_mod := scout_mod + 9
    set patrol_mod := patrol_mod + 3
  else
    set explore_mod := explore_mod + 12
  endif

  if (lng_AI_Num_Of_Enemies > 0) then
    set patrol_mod := patrol_mod + 9
  endif

  // Combat performance
  if (bool_Race_Losing_Colonies_In_Combat) then
    set attack_mod := attack_mod - 12
    set wp_mod := wp_mod + 60
  endif

  if (bool_Race_Ground_Combat_Poor) then
    set troop_mod := troop_mod + 1200
  endif

  // Technology
  if Is_Vehicle_Size_Available("Baseship") then
    set baseship_mod := baseship_mod + 6
  endif

  // Enemy designs
  if (bool_Enemy_Uses_Seeker_Weapons) or (bool_Enemy_Uses_Long_Range_Seeker_Weapons) then
    set pd_mod := pd_mod + 3
  endif

  if (bool_Enemy_Uses_Direct_Fire_Weapons) or (bool_Enemy_Ships_Are_Faster) then
    set attack_mod := attack_mod + 15
    set defense_mod := defense_mod - 15
    set seeker_mod := seeker_mod + 21
    set fighter_mod := fighter_mod + 600
  endif

  // Resource availability
  if (bool_Race_Minerals_Prod_Low) or (bool_Race_Maintenance_High) then
    set minerals_mod := minerals_mod + 6
  endif
  if (bool_Race_Organics_Prod_Low) or (bool_Race_Maintenance_High) then
    set organics_mod := organics_mod + 3
  endif
  if (bool_Race_Radioactives_Prod_Low) or (bool_Race_Maintenance_High) then
    set radioactives_mod := radioactives_mod + 3
  endif

  // Empire strategy
  if (bool_AI_Strategy_Peaceful) then
    // No changes
  endif

  if (bool_AI_Strategy_Defend) then
    set attack_mod := attack_mod - 15
    set seeker_mod := seeker_mod + 15
    set patrol_mod := patrol_mod + 6
    set pd_mod := pd_mod + 6
    set wp_mod := wp_mod + 60
    set sat_mod := sat_mod + 60
    set mine_mod := mine_mod + 1500
  endif

  if (bool_AI_Strategy_Buildup) then
    set attack_mod := attack_mod + 15
    set defense_mod := defense_mod - 18
    set seeker_mod := seeker_mod + 15
  endif

  if (bool_AI_Strategy_Attack) then
    set attack_mod := attack_mod + 15
    set defense_mod := defense_mod - 18
    set seeker_mod := seeker_mod + 15
    set pd_mod := pd_mod + 6
  endif

  if (bool_AI_Strategy_Last_Stand) or (bool_AI_Strategy_Flame_Out) then
    set attack_mod := attack_mod - 30
    set seeker_mod := seeker_mod - 15
    set explore_mod := -12
    set empire_mod := -5
    set wp_mod := wp_mod + 120
    set sat_mod := sat_mod + 60
    set mine_mod := mine_mod + 1500
  endif

  // Design strategy
  if (bool_AI_Design_Preference_Direct_Fire) then
    set attack_mod := attack_mod + 18
    set seeker_mod := seeker_mod - 18
   endif

  if (bool_AI_Design_Preference_Seeker) then
    set attack_mod := attack_mod - 18
    set seeker_mod := seeker_mod + 18
  endif

  // Ukra-Tal wanted vehicles per 1000 facilities
  // Ships
  set lng_Num_Attack_Ships             := 45 + attack_mod + Sys_Divide_Long(size_mod, 3)
  set lng_Num_Defense_Ships            := 36 + defense_mod + Sys_Divide_Long(size_mod, 3)
  set lng_Num_Seeker_Ships             := 45 + seeker_mod + Sys_Divide_Long(size_mod, 3)
  set lng_Num_PD_Ships                 := 9 + pd_mod
  set lng_Num_Explorer_Ships           := 12 + explore_mod
  set lng_Num_Scout_Ships              := 3 + scout_mod
  set lng_Num_Patrol_Ships             := 0 + patrol_mod
  set lng_Num_Boarding_Ships           := 0
  set lng_Num_Bombardment_Ships        := 0
  set lng_Num_Kamikaze_Ships           := 0
  set lng_Num_Carriers                 := 12 + carrier_mod
  set lng_Num_Drone_Carriers           := 0
  set lng_Num_Base_Ships               := 0 + baseship_mod
  set lng_Num_Space_Yard_Ships         := 6 - empire_mod
  set lng_Num_Repair_Ships             := 6 - empire_mod
  set lng_Num_Supply_Transports        := 9 - empire_mod
  set lng_Num_Troop_Transports         := 9 - empire_mod
  set lng_Num_Cargo_Transports         := 6 - empire_mod
  set lng_Num_Pop_Transports           := 6 - empire_mod
  set lng_Num_Plague_Ships             := 10 + Sys_Divide_Long(attack_mod, 5)
  set lng_Num_Sat_Layers               := 0 - empire_mod
  set lng_Num_Mine_Layers              := 6 - empire_mod
  set lng_Num_Mine_Sweepers            := 15
  set lng_Num_Mining_Ships             := 12 + minerals_mod
  set lng_Num_Farming_Ships            := 6 + organics_mod
  set lng_Num_Refining_Ships           := 6 + radioactives_mod

  // Bases
  set lng_Num_Base_Space_Yards         := 9 - empire_mod
  set lng_Num_Defense_Bases            := 15 + base_mod

  // Troops
  If Is_Vehicle_Size_Available("Large Troop") then
    set lng_Num_Troops                 := 600 + Sys_Divide_Long(troop_mod, 4)
    set lng_Num_Light_Troops           := 2100 + Sys_Divide_Long(troop_mod, 2)
    set lng_Num_Heavy_Troops           := 300 + Sys_Divide_Long(troop_mod, 4)
  else
    If Is_Vehicle_Size_Available("Medium Troop") then
      set lng_Num_Troops               := 900 + Sys_Divide_Long(troop_mod, 2)
      set lng_Num_Light_Troops         := 1800 + Sys_Divide_Long(troop_mod, 2)
    else
      set lng_Num_Troops               := 1800 + troop_mod
    endif
  endif

  // Fighters
  set lng_Num_Fighters                 := 1600 + Sys_Divide_Long(fighter_mod, 2)
  set lng_Num_Fighter_Bombers          := 1600 + Sys_Divide_Long(fighter_mod, 2)
  set lng_Num_Kamikaze_Fighters        := 0

  // Weapon Platforms
  set lng_Num_Weapon_Platforms         := 60 + Sys_Divide_Long(wp_mod, 4)
  set lng_Num_Seeker_WPs               := 300 + Sys_Divide_Long(wp_mod, 2)

  // Satellites
  set lng_Num_Satellites               := 120 + Sys_Divide_Long(sat_mod, 2)
  set lng_Num_PD_Sats                  := 40
  set lng_Num_Seeker_Sats              := 240 + Sys_Divide_Long(sat_mod, 2)
  set lng_Num_Recon_Sats               := 20
  set lng_Num_Repair_Sats              := 40

  // Mines
  set lng_Num_Mines                    := 3000 + mine_mod

  // Drones
  set lng_Num_Atk_Drones               := 0
  set lng_Num_Def_Drones               := 0
  set lng_Num_Seeker_Drones            := 0
  set lng_Num_Kamikaze_Drones          := 0
  set lng_Num_Bombardment_Drones       := 0
  set lng_Num_Repair_Drones            := 0

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Research_Spending
//------------------------------------------------------------------------
function Set_Race_Research_Spending returns boolean
vars
  research_pts:              long
  research_mod:              long
begin

  // Get our current research points
  set research_pts := Sys_Get_Empire_Current_Points(sys_long_Player_ID, POINT_TYPE_RESEARCH)

  // Set our base research and intel point percentages (Should add to 100)
  set lng_Pct_Pts_Research := 85
  set lng_Pct_Pts_Intel := 15

  // Set our research modifier
  set research_mod := Sys_Min_Long(Sys_Divide_Long(research_pts, 10000), 15)

  // Set our research spending groups
  call lst_Research_Spending_Group_Name.add("Cultural Advancement")
  call lst_Research_Spending_Group_Name.add("Theoretical Science")
  call lst_Research_Spending_Group_Name.add("Applied Science")
  call lst_Research_Spending_Group_Name.add("Weapon Technology")

  // Set our research group spending
  case Sys_Get_AI_State(sys_long_Player_ID)
    AI_STATE_EXPLORE_AND_EXPAND:
      call lst_Research_Spending_For_Group.add(1)
      call lst_Research_Spending_For_Group.add(40 + research_mod)
      call lst_Research_Spending_For_Group.add(39)
      call lst_Research_Spending_For_Group.add(20 - research_mod)
    AI_STATE_INFRASTRUCTURE:
      call lst_Research_Spending_For_Group.add(5)
      call lst_Research_Spending_For_Group.add(25 - research_mod)
      call lst_Research_Spending_For_Group.add(45 + (research_mod * 2))
      call lst_Research_Spending_For_Group.add(25 - research_mod)
    AI_STATE_ATTACK:
      call lst_Research_Spending_For_Group.add(1)
      call lst_Research_Spending_For_Group.add(19 - research_mod)
      call lst_Research_Spending_For_Group.add(45 + (research_mod * 2))
      call lst_Research_Spending_For_Group.add(35 - research_mod)
    AI_STATE_DEFEND:
      call lst_Research_Spending_For_Group.add(1)
      call lst_Research_Spending_For_Group.add(19 - research_mod)
      call lst_Research_Spending_For_Group.add(50 + (research_mod * 2))
      call lst_Research_Spending_For_Group.add(30 - research_mod)
    AI_STATE_NOT_CONNECTED:
      if Is_Tech_Area_Visible("Stellar Manipulation") then
        call lst_Research_Spending_For_Group.add(1)
        call lst_Research_Spending_For_Group.add(10)
        call lst_Research_Spending_For_Group.add(80)
        call lst_Research_Spending_For_Group.add(9)
      else
        call lst_Research_Spending_For_Group.add(1)
        call lst_Research_Spending_For_Group.add(70)
        call lst_Research_Spending_For_Group.add(20)
        call lst_Research_Spending_For_Group.add(9)
      endif
  endcase

  // Set research priority level based on number of wars we are in
  set lng_Research_Priority_Level := RESEARCH_PRIORITY_LOW

  if (lng_AI_Num_Of_Wars = 2) then
    set lng_Research_Priority_Level := RESEARCH_PRIORITY_MEDIUM
  endif
  if (lng_AI_Num_Of_Wars = 3) then
    set lng_Research_Priority_Level := RESEARCH_PRIORITY_HIGH
  endif
  if (lng_AI_Num_Of_Wars >= 4) then
    set lng_Research_Priority_Level := RESEARCH_PRIORITY_CRITICAL
  endif

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Research_Areas
//------------------------------------------------------------------------
function Set_Race_Research_Areas returns boolean
begin

  // Ukra-Tal weapons to research
  if Is_Tech_Area_Visible("Weapon Mounts") then
    call Add_Tech_Area_To_Research_List("Weapon Mounts", 1, Is_Tech_Area_Available("Small Ship Construction", 6))
  endif

  if Is_Tech_Area_Visible("Organic Weapons") then
    // Organic weapons
    call Add_Tech_Area_To_Research_List("Organic Weapons", 20, TRUE)
  else
    // X-Ray Laser, Capital Ship Missile
    call Add_Tech_Area_To_Research_List("Focused-Energy Weapons", 11, TRUE)
    call Add_Tech_Area_To_Research_List("Missile Weapons", 11, TRUE)
  endif

  if Is_Tech_Area_Visible("Biological Weapons") then
    // Plague Bomb, Toxic Injectors
    call Add_Tech_Area_To_Research_List("Biological Weapons", 11, TRUE)
  endif

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Weapon_Choices
//------------------------------------------------------------------------
function Set_Race_Weapon_Choices returns boolean
params
  vehicle_type:              string
  vehicle_tonnage:           long
  design_type:               string
begin

  // Clear previous lists
  call lst_Primary_Weapon_Name.clear()
  call lst_Secondary_Weapon_Name.clear()
  call lst_Heavy_Weapon_Name.clear()
  call lst_Special_Weapon_Name.clear()
  call lst_Bombardment_Weapon_Name.clear()
  call lst_Primary_PD_Weapon_Name.clear()
  call lst_Secondary_PD_Weapon_Name.clear()
  call lst_Special_PD_Weapon_Name.clear()
  call lst_Primary_Armor_Name.clear()
  call lst_Secondary_Armor_Name.clear()

  // Ukra-Tal Ship weapon choices
  // Ship (Attack) = Primary + Heavy (>=400kT) + Special (>=750kT)
  // Ship (Defense) = Secondary + Heavy (>=400kT) + Special (>=750kT)
  // Ship (Seeker) = Primary (>=450kT) + Heavy
  if (vehicle_type = "Ship") then
    // Primary
    call Add_Weapon_To_List("Lightning Ray", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Electric Discharge", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Hyper-Plasma Bolt", "Primary", TRUE)
    call Add_Weapon_To_List("Plasma Charge", "Primary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Primary", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Enveloping Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Toxic Injectors", "Heavy", lng_Pct_Medium_Ships > 0 and vehicle_tonnage < 300)
    call Add_Weapon_To_List("Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Heavy", TRUE)
    // Special
    call Add_Weapon_To_List("Toxic Injectors", "Special", design_type <> "Ship (Boarding)")
    call Add_Weapon_To_List("Lightning Ray", "Special", TRUE)
    call Add_Weapon_To_List("Electric Discharge", "Special", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Special", TRUE)
    // Bombardment
    call Add_Weapon_To_List("Plague Bomb", "Bombardment", TRUE)
    call Add_Weapon_To_List("Planetary Napalm", "Bombardment", TRUE)
    call Add_Weapon_To_List("Seeking Parasite", "Bombardment", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Bombardment", TRUE)
  endif

  // Ukra-Tal Base weapon choices
  // Primary + Secondary (1/500kT) + Heavy + Special (1/1000kT)
  if (vehicle_type = "Base") then
    // Primary
    call Add_Weapon_To_List("Lightning Ray", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Electric Discharge", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Hyper-Plasma Bolt", "Primary", TRUE)
    call Add_Weapon_To_List("Plasma Charge", "Primary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Primary", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Enveloping Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Heavy", TRUE)
    // Special
    call Add_Weapon_To_List("Power Lamprey", "Special", TRUE)
    call Add_Weapon_To_List("Lightning Ray", "Special", TRUE)
    call Add_Weapon_To_List("Electric Discharge", "Special", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Special", TRUE)
  endif

  // Ukra-Tal Troop weapon choices
  // Troop (Light) = Primary
  // Troop = Primary + Secondary (>=18kT)
  // Troop (Heavy) = Heavy
  if (vehicle_type = "Troop") then
    // Primary
    call Add_Weapon_To_List("Small Electric Discharge", "Primary", TRUE)
    call Add_Weapon_To_List("Ground Cannon", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Small Acid Globule", "Secondary", vehicle_tonnage >= 20)
    call Add_Weapon_To_List("Small Electric Discharge", "Secondary", TRUE)
    call Add_Weapon_To_List("Small X-Ray Laser", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Small Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Rocket Pods", "Heavy", TRUE)
  endif

  // Ukra-Tal Fighter weapon choices
  // Fighter = Primary + Secondary (>=20kT)
  // Fighter (Bomber) = Heavy
  if (vehicle_type = "Fighter") then
    // Primary
    call Add_Weapon_To_List("Small Electric Discharge", "Primary", TRUE)
    call Add_Weapon_To_List("Small X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Small Acid Globule", "Secondary", vehicle_tonnage >= 20)
    call Add_Weapon_To_List("Small Electric Discharge", "Secondary", TRUE)
    call Add_Weapon_To_List("Small X-Ray Laser", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Small Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Small Nuclear Missile", "Heavy", TRUE)
  endif

  // Ukra-Tal Satellite weapon choices
  // Satellite = Primary + Secondary (>=100kT)
  // Satellite (Seeker) = Heavy
  if (vehicle_type = "Satellite") then
    // Primary
    call Add_Weapon_To_List("Lightning Ray", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Electric Discharge", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Hyper-Plasma Bolt", "Primary", TRUE)
    call Add_Weapon_To_List("Plasma Charge", "Primary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Primary", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Enveloping Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Heavy", TRUE)
  endif

  // Ukra-Tal Weapon Platform weapon choices
  // Weapon Platform = Primary + Secondary (1/250kT) + Heavy + Special (1/250kT)
  // Weapon Platform (Seeker) = Heavy
  if (vehicle_type = "Weapon Platform") then
    // Primary
    call Add_Weapon_To_List("Lightning Ray", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Electric Discharge", "Primary", bool_Enemy_Uses_Mostly_Shields)
    call Add_Weapon_To_List("Hyper-Plasma Bolt", "Primary", TRUE)
    call Add_Weapon_To_List("Plasma Charge", "Primary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Primary", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Enveloping Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Heavy", TRUE)
    // Special
    call Add_Weapon_To_List("Power Lamprey", "Special", TRUE)
    call Add_Weapon_To_List("Lightning Ray", "Special", TRUE)
    call Add_Weapon_To_List("Electric Discharge", "Special", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Special", TRUE)
  endif

  // Ukra-Tal Drone weapon choices
  // Drone (Attack) = Primary + Secondary
  // Drone (Defense) = Heavy
  // Drone (Bombardment) = Bombardment
  if (vehicle_type = "Drone") then
    // Primary
    call Add_Weapon_To_List("Lightning Ray", "Primary", TRUE)
    call Add_Weapon_To_List("Electric Discharge", "Primary", TRUE)
    call Add_Weapon_To_List("X-Ray Laser", "Primary", TRUE)
    // Secondary
    call Add_Weapon_To_List("Enveloping Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Acid Globule", "Secondary", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Secondary", TRUE)
    // Heavy
    call Add_Weapon_To_List("Seeking Parasite", "Heavy", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Heavy", TRUE)
    // Bombardment
    call Add_Weapon_To_List("Plague Bomb", "Bombardment", TRUE)
    call Add_Weapon_To_List("Planetary Napalm", "Bombardment", TRUE)
    call Add_Weapon_To_List("Seeking Parasite", "Bombardment", TRUE)
    call Add_Weapon_To_List("Capital Ship Missile", "Bombardment", TRUE)
  endif

  // Ukra-Tal Point-Defense Choices
  // Primary Point-Defense Weapon
  call Add_Weapon_To_List("Bomblet Missile", "Primary PD", design_type = "Ship (Seeker)")
  call Add_Weapon_To_List("Point-Defense Cannons", "Primary PD", TRUE)
  // Secondary Point-Defense Weapon
  call Add_Weapon_To_List("Bomblet Missile", "Secondary PD", TRUE)
  call Add_Weapon_To_List("Flak Cannon", "Secondary PD", TRUE)
  call Add_Weapon_To_List("Point-Defense Cannons", "Secondary PD", TRUE)
  // Special Point-Defense Weapon
  call Add_Weapon_To_List("Bomblet Missile", "Special PD", bool_Enemy_Uses_Long_Range_Seeker_Weapons)
  call Add_Weapon_To_List("Flak Cannon", "Special PD", TRUE)
  call Add_Weapon_To_List("Anti-Fighter Rocket", "Special PD", TRUE)
  call Add_Weapon_To_List("Point-Defense Cannons", "Special PD", TRUE)

  // Ukra-Tal Armor choices
  if (vehicle_type = "Troop") or (vehicle_type = "Fighter") then
    call lst_Primary_Armor_Name.add("Small Organic Armor")
    call lst_Secondary_Armor_Name.add("Small Organic Armor")
  else
    if (vehicle_tonnage <= 300) then
      call lst_Primary_Armor_Name.add("Light Organic Armor")
      call lst_Secondary_Armor_Name.add("Light Organic Armor")
    else
      call lst_Primary_Armor_Name.add("Heavy Organic Armor")
      call lst_Secondary_Armor_Name.add("Heavy Organic Armor")
    endif
  endif

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Overall_Spending_Percentages
//------------------------------------------------------------------------
function Set_Race_Overall_Spending_Percentages returns boolean
vars
  ai_state:                  long
begin
  set ai_state := Sys_Get_AI_State(sys_long_Player_ID)

  // Set our construction focus
  case ai_state
    AI_STATE_EXPLORE_AND_EXPAND:
      set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_MEDIUM
    AI_STATE_INFRASTRUCTURE:
      set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_MEDIUM
    AI_STATE_ATTACK:
      set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_HIGH
    AI_STATE_DEFEND:
      set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_MEDIUM
    AI_STATE_NOT_CONNECTED:
      set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_LOW
  endcase

  if (bool_Race_Maintenance_High) or (bool_Race_Minerals_Low) or (bool_Race_Organics_Low) or (bool_Race_Radioactives_Low) then
    set lng_Vehicle_Construction_Priority_Level := VEHICLE_PRIORITY_LOW
  endif

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Strategy_Preferences
//------------------------------------------------------------------------
function Set_Race_Strategy_Preferences returns boolean
vars
begin

  // Ukra-Tal ship strategies
  set lng_Atk_Ship_Atk_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Short Range")
  set lng_Atk_Ship_Def_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Point Blank")
  set lng_Def_Ship_Atk_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Short Range")
  set lng_Def_Ship_Def_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Point Blank")
  set lng_Skr_Ship_Atk_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Maximum Range")
  set lng_Skr_Ship_Def_Strat := Sys_Get_Strategy_With_Name(sys_long_Player_ID, "Maximum Range")

  // Ukra-Tal fleet formations
  if (lng_AI_Empire_Design_Strategy = AI_DESIGN_STRATEGY_DIRECTFIRE or lng_AI_Empire_Design_Strategy = AI_DESIGN_STRATEGY_DIRECTFIRE_SMALL) then
    set lng_TF_Fill_Strategy := AI_TASK_FORCE_FILL_SPREAD_THREE
    set lng_Atk_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Trident (S)")
    set lng_Atk_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Tee (S)")
    set lng_Def_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Trident (S)")
    set lng_Def_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Tee (S)")
  else
    // Mix of direct fire and seeker ships
    if (lng_AI_Empire_Design_Strategy = AI_DESIGN_STRATEGY_MIXED or lng_AI_Empire_Design_Strategy = AI_DESIGN_STRATEGY_MIXED_SMALL) then
      set lng_TF_Fill_Strategy := AI_TASK_FORCE_FILL_BY_TYPE
      set lng_Atk_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Trident (S)")
      set lng_Atk_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Tee (S)")
      set lng_Def_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Trident (S)")
      set lng_Def_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Tee (S)")
    else
      // Mostly seeker ships
      set lng_TF_Fill_Strategy := AI_TASK_FORCE_FILL_BY_TYPE
      set lng_Atk_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Crossbow (S)")
      set lng_Atk_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Diamond (S)")
      set lng_Def_Fleet_Atk_Form := Sys_Get_Fleet_Formation_With_Name("Crossbow (S)")
      set lng_Def_Fleet_Def_Form := Sys_Get_Fleet_Formation_With_Name("Diamond (S)")
    endif
  endif

  // Ukra-Tal task force formations
  set lng_TF_Atk_Ship_Atk_Form := Sys_Get_Task_Force_Formation_With_Name("Brick (S)")
  set lng_TF_Atk_Ship_Def_Form := Sys_Get_Task_Force_Formation_With_Name("Brick (S)")
  set lng_TF_Def_Ship_Atk_Form := Sys_Get_Task_Force_Formation_With_Name("Brick (S)")
  set lng_TF_Def_Ship_Def_Form := Sys_Get_Task_Force_Formation_With_Name("Brick (S)")
  set lng_TF_Skr_Ship_Atk_Form := Sys_Get_Task_Force_Formation_With_Name("Ladder (S)")
  set lng_TF_Skr_Ship_Def_Form := Sys_Get_Task_Force_Formation_With_Name("Ladder (S)")

  return TRUE
end

//------------------------------------------------------------------------
// Set_Race_Political_Settings
//------------------------------------------------------------------------
function Set_Race_Political_Settings returns boolean
begin

  // Ukra-Tal speech file
  set str_Politics_Speech_Datafile_Filename                          := "Ukratal_AI_Speech.txt"

  // Ukra-Tal diplomacy values
  set lng_Political_Message_Score_Percent_For_Demanding_Tone         := 80
  set lng_Political_Message_Score_Percent_For_Pleading_Tone          := 125
  set lng_Politics_Base_Anger_Level                                  := 50
  set lng_Politics_Min_Anger_Allowed                                 := 5
  set lng_Politics_Anger_Reduction_For_Wars                          := 10
  set lng_Politics_Anger_Reduction_For_Similarity                    := 3
  set lng_Politics_Max_Anger_To_Propose_Treaty                       := 60
  set lng_Politics_Max_Anger_To_Accept_Treaty                        := 70
  set lng_Politics_Max_Anger_To_Counter_Treaty                       := 75
  set lng_Politics_Max_Anger_To_Accept_Gift                          := 100
  set lng_Politics_Max_Anger_To_Trade                                := 70
  set lng_Politics_Min_Anger_To_Declare_War                          := 80
  set lng_Politics_Min_Time_To_Declare_War                           := 10
  set lng_Politics_Min_Anger_To_Break_Treaty                         := 70
  set lng_Politics_Min_Time_To_Break_Treaty                          := 10
  set lng_Politics_Trade_Value_Percent_For_Enemy                     := 150
  set lng_Politics_Trade_Value_Percent_For_Friend                    := 120
  set lng_Politics_Min_Fear_To_Make_Peace                            := 20
  set lng_Politics_Min_Fear_To_Surrender                             := 50
  set lng_Politics_Min_Fear_To_Give_Enemy_Gift                       := 20
  set lng_Politics_Min_Fear_To_Give_Friend_Gift                      := 10
  set lng_Politics_Min_Fear_To_Accept_Enemy_Demand                   := 25
  set lng_Politics_Min_Fear_To_Accept_Friend_Demand                  := 15
  set lng_Politics_Max_Concurrent_Requests_To_Honor_From_One_Player  := 1
  set lng_Politics_Max_Time_To_Honor_A_Request                       := 5
  set lng_Politics_Percent_Chance_To_Propose_Treaty                  := 15
  set lng_Politics_Percent_Chance_To_Change_Treaty                   := 5

  set lng_Politics_Friendship_Pts_Ok_Friend                          := 4
  set lng_Politics_Friendship_Pts_Good_Friend                        := 7

  // Ukra-Tal alliance diplomacy values
  set lng_Politics_Max_Anger_To_Propose_Alliance                     := 40
  set lng_Politics_Max_Anger_To_Accept_Alliance                      := 50
  set lng_Politics_Max_Anger_To_Counter_Alliance                     := 50
  set lng_Politics_Alliance_Max_Anger_To_Add_Member                  := 50
  set lng_Politics_Alliance_Min_Anger_To_Remove_Member               := 60
  set lng_Politics_Alliance_Max_Anger_To_Accept_Rule_Change          := 40
  set lng_Politics_Alliance_Max_Anger_To_Accept_Send_Message         := 70
  set lng_Politics_Alliance_Max_Anger_To_Accept_Reply_Message        := 70

  // Ukra-Tal anger amounts for political status
  set lng_Politics_Max_Friendship_Pts_For_Anger                      := 7
  set lng_Politics_Anger_Amount_For_Known_Status_Time                := 2
  set lng_Politics_Anger_Amount_For_Treaty_Status_Time               := -3
  set lng_Politics_Anger_Amount_For_War_Status_Time                  := 4
  set lng_Politics_Anger_Amount_Friend_Of_Friend                     := -3
  set lng_Politics_Anger_Amount_Friend_Of_Enemy                      := 3
  set lng_Politics_Anger_Amount_Enemy_Of_Enemy                       := -2
  set lng_Politics_Anger_Amount_Enemy_Of_Friend                      := 3
  set lng_Politics_Min_Anger_For_Political_Status                    := -20
  set lng_Politics_Max_Anger_For_Political_Status                    := 20
  set lng_Politics_Min_Anger_For_Political_Status_With_Others        := -10
  set lng_Politics_Max_Anger_For_Political_Status_With_Others        := 10
  set lng_Politics_Min_Anger_Flux                                    := -3
  set lng_Politics_Max_Anger_Flux                                    := 1

  set lng_Politics_Anger_Reduction_For_Wars                          := -10
  set lng_Politics_Anger_Reduction_For_Similarity                    := -5
  set lng_Politics_Anger_Increase_For_Dissimilarity                  := 5
  set lng_Politics_Anger_Increase_For_Mega_Evil                      := 20
  set lng_Politics_Anger_Reduction_For_Mega_Evil                     := -20
  set lng_Politics_Anger_Reduction_For_AI_Team                       := -20
  set lng_Politics_Anger_Reduction_For_Common_Enemy                  := -10
  set lng_Politics_Anger_Increase_For_Friendly_Galaxy                := 10

  // Ukra-Tal anger amounts for events
  // Combat
  set lng_AI_Anger_Amount_Space_Combat_Won                           := 2
  set lng_AI_Anger_Amount_Space_Combat_Lost                          := 4
  set lng_AI_Anger_Amount_Space_Combat_Stalemate                     := 3
  set lng_AI_Anger_Amount_Ground_Combat_Won                          := 3
  set lng_AI_Anger_Amount_Ground_Combat_Lost                         := 5
  set lng_AI_Anger_Amount_Ground_Combat_Stalemate                    := 4
  set lng_AI_Anger_Amount_Mine_Explosion                             := 2

  // Treaty benefits
  set lng_AI_Anger_Amount_Treaty_Designs_Received                    := -2
  set lng_AI_Anger_Amount_Treaty_Maps_Received                       := -2
  set lng_AI_Anger_Amount_Treaty_Tech_Provided                       := -4
  set lng_AI_Anger_Amount_Treaty_Comm_Channels_Provided              := -2
  set lng_AI_Anger_Amount_Treaty_Espionage_Info_Provided             := -2
  set lng_AI_Anger_Amount_Treaty_Combat_Info_Provided                := -2

  // Intel events
  set lng_AI_Anger_Amount_Espionage                                  := 3
  set lng_AI_Anger_Amount_Sabotage                                   := 3
  set lng_AI_Anger_Amount_Planet_Cargo_Bomb                          := 5
  set lng_AI_Anger_Amount_Planet_Conditions_Change                   := 3
  set lng_AI_Anger_Amount_Planet_Plagued                             := 10
  set lng_AI_Anger_Amount_Planet_Population_Change                   := 5
  set lng_AI_Anger_Amount_Planet_Anger_Change                        := 3
  set lng_AI_Anger_Amount_Planet_Riot                                := 5
  set lng_AI_Anger_Amount_Planet_Rebel                               := 10
  set lng_AI_Anger_Amount_Planet_Value_Change                        := 5
  set lng_AI_Anger_Amount_Points_Change                              := 5
  set lng_AI_Anger_Amount_Ship_Damaged                               := 2
  set lng_AI_Anger_Amount_Ship_Cargo_Bomb                            := 2
  set lng_AI_Anger_Amount_Ship_Lost_Supply                           := 2
  set lng_AI_Anger_Amount_Ship_Lost_Movement                         := 2
  set lng_AI_Anger_Amount_Ship_Lost_Experience                       := 2
  set lng_AI_Anger_Amount_Ship_Orders_Changed                        := 2
  set lng_AI_Anger_Amount_Ship_Rebel                                 := 5

  // Stellar Manipulation
  set lng_AI_Anger_Amount_Planet_Destroyed                           := 4
  set lng_AI_Anger_Amount_Star_Destroyed                             := 6
  set lng_AI_Anger_Amount_Blackhole_Created                          := 5
  set lng_AI_Anger_Amount_Nebulae_Created                            := 4
  set lng_AI_Anger_Amount_WP_Closed                                  := 4
  set lng_AI_Anger_Amount_WP_Opened                                  := 0

  // Ukra-Tal Anger Amounts for Log Messages
  set lng_AI_Anger_Amount_Msg_General                                := -2
  set lng_AI_Anger_Amount_Msg_Reply                                  := -2
  set lng_AI_Anger_Amount_Msg_Declare_War                            := 25
  set lng_AI_Anger_Amount_Msg_Grant_Independence                     := 5
  set lng_AI_Anger_Amount_Msg_Propose_Treaty                         := -5
  set lng_AI_Anger_Amount_Msg_Accept_Treaty                          := -10
  set lng_AI_Anger_Amount_Msg_Accept_Treaty_Changes                  := -5
  set lng_AI_Anger_Amount_Msg_Refuse_Treaty                          := 5
  set lng_AI_Anger_Amount_Msg_Refuse_Treaty_Changes                  := 3
  set lng_AI_Anger_Amount_Msg_Counter_Treaty                         := -2
  set lng_AI_Anger_Amount_Msg_Counter_Treaty_Changes                 := -2
  set lng_AI_Anger_Amount_Msg_Break_Treaty                           := 15
  set lng_AI_Anger_Amount_Msg_Propose_Trade                          := -2
  set lng_AI_Anger_Amount_Msg_Accept_Trade                           := -4
  set lng_AI_Anger_Amount_Msg_Refuse_Trade                           := 2
  set lng_AI_Anger_Amount_Msg_Counter_Trade                          := 0
  set lng_AI_Anger_Amount_Msg_Request_Gift                           := 5
  set lng_AI_Anger_Amount_Msg_Give_Gift                              := -5
  set lng_AI_Anger_Amount_Msg_Accept_Gift                            := -5
  set lng_AI_Anger_Amount_Msg_Refuse_Gift                            := 5
  set lng_AI_Anger_Amount_Msg_Request_Accept                         := -5
  set lng_AI_Anger_Amount_Msg_Request_Refuse                         := 5
  set lng_AI_Anger_Amount_Msg_Request_Surrender                      := 15
  set lng_AI_Anger_Amount_Msg_Propose_Alliance                       := -5
  set lng_AI_Anger_Amount_Msg_Accept_Alliance                        := -10
  set lng_AI_Anger_Amount_Msg_Refuse_Alliance                        := 5
  set lng_AI_Anger_Amount_Msg_Leave_Alliance                         := 15

  // Set Ukra-Tal anger amounts for ships/units/colonies in their territory
  set lng_AI_Anger_Amount_Ships_In_Territory                         := 3
  set lng_AI_Anger_Amount_Units_In_Territory                         := 6
  set lng_AI_Anger_Amount_Colonies_In_Territory                      := 6

  // Ukra-Tal anger values
  call AI_Set_Political_Anger_For_Log_Types()
  call AI_Set_Political_Anger_For_Messages()
  call AI_Set_Political_Anger_For_Wars()

  // Ukra-Tal element anger values
  call AI_Set_Political_Treaty_Elements()
  call AI_Set_Political_Alliance_Elements()

  return TRUE
end

//------------------------------------------------------------------------